package com.lagou.edu.utils;

import java.util.Random;

public class Tools {

    private Tools() {

    }

    private static Random random = new Random();

    public static String getRandomCode(int length) {
        if (length <= 0 || length >= Integer.MAX_VALUE) return "";
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < length; i++) {
            buffer.append(random.nextInt(9));
        }
        return buffer.toString();
    }

}
